/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package projecteuler;

/**
 *
 * @author ChunchO
 */
public class Problem017 {
	static String[] os = {"","one","two","three","four","five","six","seven","eight","nine"};
	static String[] ts = {"","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
	static String[] hs = {"","onehundredand","twohundredand","threehundredand","fourhundredand","fivehundredand","sixhundredand","sevenhundredand","eighthundredand","ninehundredand"};
	static String[] special = {"ten","eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};

	public static void main(String[] args){
		int count = 0;
		for(int i = 1;i<1000;i++){
			int h = i/100;
			int t = (i/10)%10;
			int o = i%100%10;
			System.out.println(h+"\t"+t+"\t"+o);
			
			if(t==1)
			{
				System.out.println(hs[h]+"\t"+special[o]);
				count += special[o].length()+hs[h].length();
			}
			else
			{
				System.out.println(hs[h]+"\t"+ts[t]+"\t"+os[o]);
				count += os[o].length()+ts[t].length()+hs[h].length();
			}

		}
		//restar 9 and
		count -= 9*3;
		//sumarle one thousand
		count += 11;
		System.out.println(count);
	}
}
